<?php
/**
 * Created by PhpStorm.
 * User: 66500
 * Date: 2019/3/19
 * Time: 9:38
 */
namespace xiaokang;
class Config
{

    static public $conf = array();

    static public function get($name,$file)
    {
        /**
         * 1 判断配置文件是否存在
         * 2 判断配置是否存在
         * 3 缓存配置
         */
        if (isset(self::$conf[$file]))
        {
            return self::$conf[$file][$name];
        }else{
            $path = CONF_DIR.$file.'.php';
            if (is_file($path))
            {
                $path = CONF_DIR.$file.'.php';
                $conf = require $path;
                if (isset($conf[$name]))
                {
                    self::$conf[$file] = $conf;
                    return $conf[$name];
                } else {
                    throw new \Exception('没有这个配置'.$file);
                }
            } else {
                throw new \Exception('找不到这个配置'.$file);
            }
        }



    }

}